class Solution1 {
    public int evalRPN(String[] tokens) {
            Stack<Integer> stack=new Stack<>();
            for(String x :tokens){
                
                if(!isOperation(x)){
                    stack.push(Integer.parseInt(x));
                }else{
                    int num2=stack.pop();
                    int num1=stack.pop();
                    switch(x){
                        case "+":
                        stack.push(num1+num2);
                        break;
                         case "-":
                        stack.push(num1-num2);
                        break;
                         case "*":
                        stack.push(num1*num2);
                        break;
                         case "/":
                        stack.push(num1/num2);
                        break;
                    }
                }
                
            }
            return stack.pop();



    }
    public boolean isOperation(String s){
        if(s.equals("+")||s.equals("-")||s.equals("*")||s.equals("/")){
            return true;
        }
        return false;
    }
}